package com.huawei.appgallery.forum.posts.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.util.AttributeSet;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import o.bqy;
import o.epv;

public class PostContentImageView extends ImageView {
    private static final int ˋ = epv.ˋ(bqy.ˋ().ˏ(), 4);
    private float ˊ;
    private float ˏ;

    public PostContentImageView(Context context) {
        super(context);
    }

    public PostContentImageView(Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public PostContentImageView(Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        this.ˊ = (float) getWidth();
        this.ˏ = (float) getHeight();
    }

    protected void onDraw(Canvas canvas) {
        if (this.ˊ > ((float) ˋ) && this.ˏ > ((float) ˋ)) {
            Path path = new Path();
            path.moveTo((float) ˋ, 0.0f);
            path.lineTo(this.ˊ - ((float) ˋ), 0.0f);
            path.quadTo(this.ˊ, 0.0f, this.ˊ, (float) ˋ);
            path.lineTo(this.ˊ, this.ˏ - ((float) ˋ));
            path.quadTo(this.ˊ, this.ˏ, this.ˊ - ((float) ˋ), this.ˏ);
            path.lineTo((float) ˋ, this.ˏ);
            path.quadTo(0.0f, this.ˏ, 0.0f, this.ˏ - ((float) ˋ));
            path.lineTo(0.0f, (float) ˋ);
            path.quadTo(0.0f, 0.0f, (float) ˋ, 0.0f);
            canvas.clipPath(path);
        }
        super.onDraw(canvas);
    }
}
